/*
 * @Author: tangchuan 1944302118@qq.com
 * @Date: 2024-02-27 16:22:42
 * @LastEditors: tangchuan 1944302118@qq.com
 * @LastEditTime: 2024-06-12 14:57:56
 * @FilePath: \jeecg-novel\src\views\website\bookSetting\BookSetting.data.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Table';
import { rules } from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
  {
    title: '小说ID',
    align: 'center',
    dataIndex: 'bookId',
  },
  {
    title: '小说名',
    align: 'center',
    dataIndex: 'bookName',
  },
  {
    title: '排序号',
    align: 'center',
    dataIndex: 'sort',
  },
  {
    title: '平台',
    align: 'center',
    dataIndex: 'platform_dictText',
  },
  {
    title: '类型',
    align: 'center',
    dataIndex: 'type_dictText',
  },{
    title: 'H5链接',
    align: 'center',
    dataIndex: 'h5Url',
  },
  {
    title: '小说图片',
    align: 'center',
    dataIndex: 'picUrl',
    customRender: render.renderImage,
  },
  {
    title: '是否收费',
    align: 'center',
    dataIndex: 'isVip',
    customRender: ({ text }) => {
      return text ? '是' : '否';
    },
  },
];
columns.forEach((item) => {
  item.resizable = true;
});
//查询数据
export const searchFormSchema: FormSchema[] = [];

//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '小说ID',
    field: 'bookId',
    component: 'InputNumber',
  },
  {
    label: '排序号',
    field: 'sort',
    component: 'InputNumber',
  },
  {
    label: '类型，0：轮播图，1：顶部小说栏设置，2：本周强推，3：热门推荐，4：精品推荐',
    field: 'type',
    component: 'JSearchSelect',
    componentProps: {
      dict: '',
    },
  },
  {
    label: '小说图片',
    field: 'picUrl',
    component: 'JImageUpload',
    componentProps: {},
  },
  // TODO 主键隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false,
  },
];
